<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">
      body {
        background-color: black;
      }
      .container {
        /*居中*/
        margin: auto;
        border: 1px solid black;
        width: 850px;
      }
      img {
        width: 850px;
      }
    </style>
    <script>
      onload=function () {
        setInterval(changeImg,2000);
      }
      let i =0;
      function changeImg() {
        i++;
        let img = document.getElementById("imgId");
        img.src="../img/"+i+".jpg";
        if(i==4) {
          i=-1;
        }
      }
    </script>
</head>
<body>
    <div class="container">
      <img src="../img/0.jpg" id="imgId">
    </div>
</body>
</html>